Skip to content

Conversation

@cderv
Copy link
Collaborator

@cderv cderv commented Jun 4, 2025

This is a bad problem when you run quarto CLI from another process having R_HOME set (like running from an R session): another R version would be used;

This solves quarto-dev/quarto-r#204, but also problem on Windows

❯ $env:R_HOME="C:/Program Files/R/R-4.5.0"

❯ quarto check knitr
Quarto 99.9.9
[>] Checking R installation...........OK
      Version: 4.3.2
      Path: C:/PROGRA~1/R/R-43~1.2
      LibPaths:
        - C:/Users/chris/AppData/Local/R/win-library/4.3
        - C:/Program Files/R/R-4.3.2/library
      knitr: (None)
      rmarkdown: (None)

      The knitr package is not available in this R installation.
      Install with install.packages("knitr")
      The rmarkdown package is not available in this R installation.
      Install with install.packages("rmarkdown")

This is because we append bin and Rscript and test the path

// if there is an R_HOME then respect that
const rHome = Deno.env.get("R_HOME");
debug(`Looking for '${binary}' in R_HOME: ${rHome}`);
if (rHome) {
let rHomeBin = join(rHome, "bin", binary);
if (safeExistsSync(rHomeBin)) {

We need to add .exe on Windows if we test path existence.

Note: I really would like to backport this as this is a bad issue.

@posit-snyk-bot
Copy link
Collaborator

posit-snyk-bot commented Jun 4, 2025

🎉 Snyk checks have passed. No issues have been found so far.

security/snyk check is complete. No issues have been found. (View Details)

license/snyk check is complete. No issues have been found. (View Details)

@cderv cderv merged commit 4c44c81 into main Jun 5, 2025
49 checks passed
@cderv cderv deleted the windows/rscript-detection branch June 5, 2025 08:34
cderv added a commit to quarto-dev/quarto-r that referenced this pull request Jun 5, 2025
* move import where it is used

* processx can return different error than the one from `error_on_status`

* Set `QUARTO_R` for ealier versions of Quarto to overcome the R_HOME detection problem

Fixed in 1.8 at quarto-dev/quarto-cli#12887

* missing test_path in tests

* Add NEWS

* bump version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants